{"ast":null,"code":"var _s = $RefreshSig$();\nimport React from \"react\";\nexport const findContactOrReturnNull = (searchedUser, currentUser, collectionContacts) => {\n  _s();\n  const [contact, setContact] = React.useState();\n  collectionContacts.items.forEach((item, index) => {\n    if (item.fromUser.id === searchedUser.id && item.toUser.id === currentUser.id || item.toUser.id === searchedUser.id && item.fromUser.id === currentUser.id) {\n      setContact({\n        index: index,\n        contact: {\n          ...item\n        }\n      });\n    }\n  });\n  if (contact !== null && contact !== void 0 && contact.index) {\n    return contact;\n  }\n  return {\n    contact: null\n  };\n};\n_s(findContactOrReturnNull, \"eInHzJQOLTPKpwidH3SY2hchutM=\");","map":{"version":3,"names":["React","findContactOrReturnNull","searchedUser","currentUser","collectionContacts","contact","setContact","useState","items","forEach","item","index","fromUser","id","toUser"],"sources":["/data/messenger.client/src/utils/Contact.ts"],"sourcesContent":["import {UserListItem} from \"../models/response/UserListItem\";\nimport {ContactListResponse} from \"../models/response/ContactListResponse\";\nimport {ContactWithIndex} from \"../models/props/ContactWithIndex\";\nimport React from \"react\";\n\nexport const findContactOrReturnNull = (\n    searchedUser: UserListItem,\n    currentUser: UserListItem,\n    collectionContacts: ContactListResponse\n    ): ContactWithIndex => {\n    const [contact, setContact] = React.useState<ContactWithIndex>();\n\n    collectionContacts.items.forEach((item, index) => {\n        if (\n            (item.fromUser.id === searchedUser.id && item.toUser.id === currentUser.id) ||\n            (item.toUser.id === searchedUser.id && item.fromUser.id === currentUser.id)\n        ) {\n            setContact({\n                    index: index,\n                    contact: {...item}\n            });\n        }\n    });\n\n    if (contact?.index) {\n        return contact;\n    }\n\n    return {\n        contact: null\n    };\n}\n"],"mappings":";AAGA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAO,MAAMC,uBAAuB,GAAG,CACnCC,YAA0B,EAC1BC,WAAyB,EACzBC,kBAAuC,KAChB;EAAA;EACvB,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGN,KAAK,CAACO,QAAQ,EAAoB;EAEhEH,kBAAkB,CAACI,KAAK,CAACC,OAAO,CAAC,CAACC,IAAI,EAAEC,KAAK,KAAK;IAC9C,IACKD,IAAI,CAACE,QAAQ,CAACC,EAAE,KAAKX,YAAY,CAACW,EAAE,IAAIH,IAAI,CAACI,MAAM,CAACD,EAAE,KAAKV,WAAW,CAACU,EAAE,IACzEH,IAAI,CAACI,MAAM,CAACD,EAAE,KAAKX,YAAY,CAACW,EAAE,IAAIH,IAAI,CAACE,QAAQ,CAACC,EAAE,KAAKV,WAAW,CAACU,EAAG,EAC7E;MACEP,UAAU,CAAC;QACHK,KAAK,EAAEA,KAAK;QACZN,OAAO,EAAE;UAAC,GAAGK;QAAI;MACzB,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;EAEF,IAAIL,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEM,KAAK,EAAE;IAChB,OAAON,OAAO;EAClB;EAEA,OAAO;IACHA,OAAO,EAAE;EACb,CAAC;AACL,CAAC;AAAA,GA1BYJ,uBAAuB"},"metadata":{},"sourceType":"module"}